\documentclass[10pt,fleqn]{article}
\usepackage{times}
\usepackage{fullpage}
\usepackage{amsmath}
\usepackage{algorithmic}
\usepackage{algorithm}
\setlength{\parindent}{0in}
\setlength{\parskip}{0.1in}
\begin{document}



\textsc{Cell.getScore}

\begin{algorithmic}[1]

\STATE $maxChanges \gets 0$
\STATE
\FORALL{$Molecule \in Cell$}
	\STATE $prevDir, currentDir \gets 0$
	\STATE $numChanges \gets 0$
	\STATE
	\FOR{$t = 1 .. rkData.length$}

		\WHILE{$rkData[t] - rkData[t-1] == 0$}
			\STATE $t \gets t+1$
		\ENDWHILE
		\STATE
		\IF{$rkData[t] - rkData[t-1] > 0$}
			\STATE $currentDir \gets increasing$
		\ENDIF
		\STATE
		\IF{$rkData[t] - rkData[t-1] < 0$}
			\STATE $currentDir \gets decreasing$
		\ENDIF
		\STATE
		\IF{$currentDir == increasing \&\& prevDir == decreasing$}
			\STATE $numChanges \gets numChanges + 1$
		\ENDIF
		\STATE
		\IF{$currentDir == decreasing \&\& prevDir == increasing$}
			\STATE $numChanges \gets numChanges + 1$
		\ENDIF
		\STATE
		\STATE $prevDir \gets currentDir$
	\ENDFOR
	\STATE
	\IF{$numChanges > maxChanges$}
		\STATE $maxChanges \gets numChanges$
	\ENDIF
\ENDFOR
\STATE
\RETURN $maxChanges$

\end{algorithmic}

\end{document}
